<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>
        ${@com.leonzx.base.utils.TitleNameConstants.LOGIN_TITLE}
    </title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta http-equiv="Cache-Control" content="no-siteapp"/>

    <!--<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />-->
    <link rel="stylesheet" href="${ctxPath}/static/xadmin/css/font.css">
    <link rel="stylesheet" href="${ctxPath}/static/xadmin/css/xadmin.css">
    <script type="text/javascript" src="${ctxPath}/static/jquery/jquery-1.11.3.js"></script>
    <script src="${ctxPath}/static/xadmin/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="${ctxPath}/static/xadmin/js/xadmin.js"></script>
    <script type="text/javascript" src="${ctxPath}/static/base/js/common.js"></script>
</head>
<body class="login-bg">

<div class="login layui-anim layui-anim-up">
    <div class="message">
        ${@com.leonzx.base.utils.TitleNameConstants.LOGIN_NAME}
    </div>
    <div id="darkbannerwrap"></div>

    <form method="post" class="layui-form">
        <input name="username" placeholder="用户名" type="text" lay-verify="required" class="layui-input">
        <hr class="hr15">
        <input name="password" lay-verify="required" placeholder="密码" type="password" class="layui-input">
        <hr class="hr15">
        <input value="登录" lay-submit lay-filter="login" style="width:100%;" type="submit">
        <hr class="hr20">
    </form>
</div>

<script>

    <@>if(shiro.authenticated()) {
        window.location.href = '${ctxPath}/index';
    <@>}

    <@>if(code! == '9') {
        $.msg('${msg}', function () {}, 2, 5000);
    <@>}


    if (window != top) {
        top.location.href = location.href;
    }

    $(function () {
        layui.use('form', function () {
            var form = layui.form;
            //监听提交
            form.on('submit(login)', function (data) {
                //ajax判断登录

                console.info(data);
                $.cajax('${ctxPath}/loginInput', {
                    username: data.field.username,
                    password: data.field.password
                }, function (r) {
                    var code = r.code;
                    var msg = r.msg;
                    if (code == '1') {
                        $.msg(msg, function () {
                            location.href = '${ctxPath}/index'
                        }, 1, 1000);
                    } else {
                        $.msg(msg, function () {
                        }, 2, 1000);
                    }
                });
                return false;
            });
        });
    })
</script>
<!-- 底部结束 -->
</body>
</html>